package gameUi.panel
{
	import flash.events.MouseEvent;

	public class InfoPanel extends InfoPanelMC
	{
		private static var instance:InfoPanel;
		
		public function InfoPanel(key:Key)
		{
			cmdClose.addEventListener(MouseEvent.CLICK,clickClose);
			bg.addEventListener(MouseEvent.MOUSE_DOWN,onBeginDrag);
			BlackJack._stage.addEventListener(MouseEvent.MOUSE_UP,onStopDrag);
		}
		
		public static function getInstance():InfoPanel{
			return instance?instance:new InfoPanel(new Key());
		}
		
		private function onBeginDrag(e:MouseEvent):void{
			this.startDrag();
		}
		
		private function onStopDrag(e:MouseEvent):void{
			this.stopDrag();
		}
		
		private function clickClose(e:MouseEvent):void{
			if(this.parent) this.parent.removeChild(this);
		}
		
		public function showInfo(type:int):void{
			if(type == 0){
				panelTxt.text = "账户积分不足，您可以参加商城活动或充值以获得积分";
			}else if(type == 1){
				panelTxt.text = "没有足够的筹码余额，请点击“兑换筹码”，用积分余额购买筹码";
			}else if(type == 2){
				panelTxt.text = "服务器繁忙";
			}else if(type == 3){
				panelTxt.text = "兑换成功";
			}else if(type == 4){
				panelTxt.text = "与服务器断开";
			}else if(type == 5){
				panelTxt.text = "下注筹码额只能在1~1000内";
			}else if(type == 6){
				panelTxt.text = "如果玩家游戏开始后15分钟没有操作，将自动下线，若正在牌局中，已下注筹码不会返还。";
			}
			this.x = BlackJack._stage.stageWidth/2;
			this.y = BlackJack._stage.stageHeight/2;
			BlackJack._stage.addChild(this);
		}
	}
}
class Key{}